SelBench Reference
=SelBench 1.1= Installer: https://addons.mozilla.org/en-US/firefox/addon/selenium-ide-selbench/ =Description= Provides utilities for testing, validating, and benchmarking Selenium IDE scripts. This is especially useful for instrumenting scripts that are used to test Selenium IDE extensions. =Features= * Convenience functions: $w() and $d() are shorthand references to the window and document objects of the target webpage * Commands: alert, log, clearLog, deleteVars, expectError, emit, assertEmitted, resetEmitted, startTimer, timerElapsed =Examples of Use= Object access: assertEval|$d().title $w().document.title Simple logging and prompting: alert|"hello world" log|"hello world" clearLog Undefining Selenium variables: deleteVars|a,b,c Verifying that a command will fail as expected: expectError|"n is not define" getEval|n Tracking state and sequence,("$" + "{n}~" prevents Selenium variable substitution): resetEmitted deleteVar|n emit|"${n}" store|0|n emit|n++ emit|"${n}" assertEmitted|"$" + "{n}~" + 0 + "~" + 1 Timing script execution: startTimer timerElapsed $w() and $d() can be used in expressions: assertEval|$d().title $w().document.title|true =Selenium Server= Sorry, this feature has a significant bug, and is not currently supported. Selenese scripts that use SelBench commands can also be run in Selenium Server via the -user-extensions and -htmlSuite options. Get the current user-extensions.js here: https://raw.githubusercontent.com/refactoror/SelBench/master/user-extensions.js For more information on running Selenium Server, see: http://www.seleniumhq.org/docs/08_user_extensions.jsp#using-user-extensions-with-selenium-ide Note that prior to version 1.1 SelBench has been a Firefox extension only, whereas Selenium Server can target a wide range of browsers. SelBench currently passes its full regression test suite when run against: * firefox (31.4) * googlechrome (40.0) * opera (27.0) Community help is welcome and encouraged in expanding this list. There are currently known issues with: * iexplorer (11.0): Object.defineProperties fails - test-startup hangs * safari (5.1.7): htmlTestRunner is not defined - test-startup hangs Running scripts in Selenium Server introduces the possibilty of browser compatibility issues, especially when running IDE-produced scripts against non-Firefox browsers. Potential pain points include differences in JavaScript error messaging, (e.g., try/catch), and DOM property values, (e.g., $w().title). When reporting an issue, be sure to provide very specific browser/OS info, as well as the faling test case, test html, and error log. Better yet, if you can fix the problem, submit a github pull request -- which is how server support came about in the first place. A big thanks to Matthew Kastor for this contribution! For an overview of how the SelBench user extension works, see: https://github.com/refactoror/SelBench/blob/master/notes/SeleniumServer-notes.txt =Function Reference= =Command Reference= =Limitations= The expectError command operates on the next command to be executed. But it cannot be used on: * Commands that cannot fail, (e.g., startTimer, the SelBlocks exitTest command) * Commands that themselves manage other commands, (e.g., itself, the SelBlocks try command) Never use the ...AndWait counterpart of a SelBench command, e.g., logAndWait. (Selenium automatically registers one with every defined command, even though it does not always make sense.) If you use one of these, (usually via inadvertent auto-completion), SelBench will throw an error when you try to start the script in the IDE. This is a bit more difficult to diagnose in Selenium Server, which cannot currently detect the situation, and therefore simply hangs without an error when such a command executes. =Troubleshooting= Selenium Server Testsuite works in the IDE, but won't start in Server * You haven't provided the SelBench user-extensions.js on the command line. Test hangs at SelBench command * You may have used the AndWait counterpart command. This is never valid because SelBench commands do not interact with webpages. =Revision History= * 2015-02-12: v1.1 ** Added support for Selenium Server. (A big thanks to Matthew Kastor for this contribution) ** Added clearLog command. ** Added deleteVars command, (deprecated deleteVar). ** Fixed Issue #4 expectError fails on unexpected error ** Fixed Issue #5 expectError not clearing script error status * 2013-03-07: v1.0 All versions: https://addons.mozilla.org/en-US/firefox/addon/selenium-ide-selbench/versions/